package com.study.结构型模式.装饰者模式;

public class Decorator extends Drink{

    private Drink obj;

    public Decorator(Drink drink){
        this.obj = drink;
    }

    @Override
    public float cost() {
        //这里super调用的是调料（装饰者）的价格，obj调用的是咖啡
        return super.getPrice() + obj.cost();
    }

    @Override
    public String getDes() {
        return super.getDes()+"+"+obj.getDes();
    }
}
